package com.duowan.realtime.hash;

public abstract class AbstractCustomHashFunction {
	protected int k;
	protected int m;
	

	/**
	 * Computes hash values.
	 * 
	 * @param value
	 *            the byte[] representation of the element to be hashed
	 * @param m
	 *            integer output range [1,m]
	 * @param k
	 *            number of hashes to be computed
	 * @return int array of k hash values
	 */
	public abstract int[] hash(byte[] value, int m, int k);
	
	/**
	 * Returns the size of the bloom filter.
	 * 
	 * @return Size of the bloom filter in bits
	 */
	public int getM() {
		return m;
	}

	/**
	 * Returns the number of hash functions.
	 * 
	 * @return number of hash functions used
	 */
	public int getK() {
		return k;
	}
	
	/**
	 * Set the number of hash functions
	 * @param k
	 */
	public void setK(int k) {
		this.k = k;
	}

	/**
	 * Set the size of the bloom filter in bits 
	 * @param m
	 */
	public void setM(int m) {
		this.m = m;
	}
}
